<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>待发消息记录列表</title>
    <link href="../../../layui/css/layui.css" rel="stylesheet">
    <link href="../../../static/css/style.css" rel="stylesheet">
    <script src="../../../static/js/jquery.min.js"></script>
    <script src="../../../static/js/jquery.cookie.js"></script>
    <script src="../../../layui/layui.js"></script>
    <script src="../../../static/js/base.js"></script>
    <script src="../../../static/js/ax.js"></script>
    <!--[if lt IE 9]>
    <script src="../../../static/js/html5.js"></script>
    <script src="../../../static/js/respond.js"></script>
    <![endif]-->
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card content-wrap">
        <!--查询-->
        <!--<div class="layui-form layui-card-header layuiadmin-card-header-auto">-->
        <form class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-sm3">
                        <label class="layui-form-label">消息内容</label>
                        <div class="layui-input-block">
                            <input type="text" id="mrContent" placeholder="请输入消息内容" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-sm3">
                        <label class="layui-form-label">推送方式</label>
                        <div class="layui-input-block">
                            <select id="pushType">
                                <option value="">全部</option>
                                <option value="app">APP</option>
                                <option value="wx_public">微信公众号</option>
                                <option value="wx_applet">微信小程序</option>
                                <option value="sms_timely">及时短信</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-row layui-col-space10">
                    <!--<div class="layui-col-sm3">-->
                    <!--<label class="layui-form-label">时间类型</label>-->
                    <!--<div class="layui-input-block">-->
                    <!--<select id="timeType">-->
                    <!--<option value="dsc_sign">创建时间</option>-->
                    <!--<option value="dsc_start">修改时间</option>-->
                    <!--</select>-->
                    <!--</div>-->
                    <!--</div>-->
                    <div class="layui-col-sm3">
                        <label class="layui-form-label">发送开始时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input" id="fromTime" placeholder="发送开始时间" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-sm3">
                        <label class="layui-form-label">发送结束时间</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input" id="toTime" placeholder="发送结束时间" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-sm3">
                        <a id="doSearch" class="layui-btn add_btn"><i class="layui-icon layui-icon-search"></i>搜索</a>
                        <button type="reset" class="layui-btn delete_btn"><i class="layui-icon layui-icon-delete"></i>清空</button>
                    </div>
                </div>
            </div>
        </form>


        <!--数据列表展示-->
        <div>
            <!--<script type="text/html" id="optToolbar">-->
                <!--<div>-->
                    <!--<button class="layui-btn layuiadmin-btn-useradmin delete_btn ax-btn" lay-event="delRecord"><i class="layui-icon layui-icon-delete"></i>删除</button>-->
                <!--</div>-->
            <!--</script>-->

            <table class="layui-hide" id="dataListTable"
                   lay-filter="active"></table>
        </div>


    </div>
</div>


</body>

<script>

    var table;
    var tableObj;

    layui.use(['table','form','layer','laydate'], function() {
        table = layui.table;
        var form = layui.form,
            layDateFrom = layui.laydate,
            layDateTo = layui.laydate,
            layer=layui.layer;

        // 初始化日期控件
        var fromTime = layDateFrom.render({
            elem: '#fromTime',
            max:'nowTime',//默认最大值为当前日期
            done:function(value, date) {
                if(date.hasOwnProperty("year")) {
                    toTime.config.min={
                        year:date.year,
                        month:date.month-1,//关键
                        date:date.date,
                        hours:date.hours,
                        minutes:date.minutes,
                        seconds:date.seconds
                    };
                }
            }
        });
        var toTime = layDateTo.render({
            elem: '#toTime',
            max:'nowTime',//默认最大值为当前日期
            done:function(value, date) {
                if(date.hasOwnProperty("year")) {
                    fromTime.config.max={
                        year:date.year,
                        month:date.month-1,//关键
                        date:date.date,
                        hours:date.hours,
                        minutes:date.minutes,
                        seconds:date.seconds
                    };
                }
            }
        });

        tableObj = ax.VTable({
            id: 'loadDataList',
            elem : '#dataListTable',
            autoPrefix: false,
            url :backendWebUrl + '/api/message/record/listWaitPushRecord',
            // toolbar: '#optToolbar',
            title:'待发消息记录列表',
            cols : [ [
                {type: 'numbers', width : 80, title : '序号', fixed : 'left'},
                {field : 'mrSenderName', width : 100, title : '推送人', fixed : 'left' },
                {field : 'mrDsName', width : 200, title : '推送组织'},
                {field : 'pushTypeName', width : 150, title : '推送方式'},
                {field : 'mrContent', minWidth : 250, title : '推送内容' },
                {field : 'mrRecipient', width : 150, title : '接收人' },
                {field : 'mrRecipientAccount', width : 180, title : '接收人账号' },
                {field : 'submitTime', width : 180, title : '提交时间' }
            ] ]

        });

        var $ = layui.$;

        $('#doSearch').on('click', function(){
            searchData();
        });
    });

    function searchData() {
        //执行重载
        tableObj.reload({
            page : {
                curr: 1 //重新从第 1 页开始
            },
            where : {
                mrContent : $('#mrContent').val(),
                pushType : $('#pushType').val(),
                fromTime : $('#fromTime').val(),
                toTime : $('#toTime').val()
            }
        });
    }
</script>
</html>